<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 导入依赖 -->
    <script src='https://unpkg.com/@antv/l7'></script>
    <script src="https://lib.baomitu.com/jquery/2.2.4/jquery.js"></script>
    <script src="https://unpkg.com/@antv/l7-draw"></script>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        #map {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            background-color: rgba(255, 0, 0, 0.565);
        }
    </style>
</head>

<body>
    <div id="map">

    </div>
    <script>
        /* Scene场景 -L7不提供地图,只专注于地理数据可视化
        Scene 
        1、Map
        2、Layer
         */
        const scene = new L7.Scene({
            /* 设置场景的挂载点 */
            id: "map",
            map: new L7.GaodeMap({
                style: "dark",
                center: [114.30, 30.50],
                // pitch: 60,
                /* zoom可以实现放大和缩小级别 */
                zoom: 8
            }),
            logoVisible: false
        })
        // const { DrawEvent, DrawLine } = L7.Draw
        // scene.on('loaded', () => {
        //     const drawLine = new DrawLine(scene, {
        //         //展示距离
        //         distanceOptions: {},
        //     });
        //     drawLine.enable();

        //     drawLine.on(DrawEvent.Change, (allFeatures) => {
        //         console.log(allFeatures);
        //     });
        // });
        const { DrawEvent, DrawPolygon } = L7.Draw
        scene.on('loaded', () => {
            const drawPolygon = new DrawPolygon(scene, {
                //展示面积
                areaOptions: {},
            });
            drawPolygon.enable();

            drawPolygon.on(DrawEvent.Change, (allFeatures) => {
                console.log(allFeatures);
            });
        });
    </script>
</body>

</html>